package com.shop.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shop.mapper.DtsGoodsSpecificationMapper;
import com.shop.pojo.DtsGoodsSpecification;
import com.shop.service.DtsGoodsSpecificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @ClassName DtsGoodsSpecificationServiceImpl
 * @Author xiao宋
 * @Date 20:59  2022/10/17
 * @Version 1.0
 * @Description TODO
 */
@Service
public class DtsGoodsSpecificationServiceImpl implements DtsGoodsSpecificationService {
    @Autowired
    DtsGoodsSpecificationMapper specificationMapper;
    @Override
    public void insert(DtsGoodsSpecification specification) {
        specification.setUpdateTime(new Date());
        specification.setAddTime(new Date());
        specification.setDeleted(false);
        specificationMapper.insert(specification);
    }

    @Override
    public void deleteById(Integer goodsId) {
        LambdaQueryWrapper<DtsGoodsSpecification>w=new LambdaQueryWrapper<>();
        w.eq(DtsGoodsSpecification::getGoodsId, goodsId);
        specificationMapper.delete(w);

    }
}
